import {
  Format
}
from "../../utils/common";
const format = new Format()
Page({
  data: {
    tagData: [
      // { date: '2019-04-14', tag: '还房贷', tagColor: 5 },
      // { date: '2019-04-28', tag: '公积金', tagColor: 2 },
    ],
  },
   onLoad: function (options) {
    console.log(options)
    if (options && options.url == 'rechargeOrder') {
      this.setData({
        calendarUrl: 'rechargeOrder'
      });
    }
  },
  handleSelect([startDate, endDate]) {
     const startTime = format.date("yyyy-MM-dd", startDate)
     const endTime = format.date("yyyy-MM-dd", endDate)
     console.log(startTime,endTime)
     setTimeout(() => {
       my.setStorageSync({
        key: 'time',
        data: {
          startTime: startTime,
          endTime: endTime,
        }
      });
       my.navigateBack()
      // if (this.data.calendarUrl == 'rechargeOrder') {
      //     my.redirectTo({
      //       url: '/pages/rechargeOrder/rechargeOrder?startTime=' + startTime + '&endTime=' + endTime
      //     })
      // } else {
      //   my.redirectTo({
      //     url: '/pages/order/myOrder/myOrder?startTime=' + startTime + '&endTime=' + endTime
      //   })
      // }
     }, 500);
  },
  onMonthChange() {},
});